package com.papper.mng.domain;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @Author:Lajiao
 * @Date:2014年8月21日
 * @Time:下午12:27:57
 * @Description:JSON返回信息
 */
public class LayResponse {
    private Integer code = 0;
    private String  msg  = "";
    private Integer count;
    private List    data;

    public LayResponse(Integer code, String msg, Integer count, List data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public LayResponse(List data) {
        if (data == null || data.isEmpty()) {
            this.count = 0;
            this.data = Lists.newArrayList();
        } else {
            this.count = data.size();
            this.data = data;
        }
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public List<Object> getData() {
        return data;
    }

    public void setData(List<Object> data) {
        this.data = data;
    }
}
